package com.cqq.print.business.service.impl;

import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cqq.common.core.bean.PageInfoBean;
import com.cqq.common.core.util.BeanUtil;
import com.cqq.print.business.dao.StatisticsPublisherDao;
import com.cqq.print.business.dao.domain.StatisticsPublisher;
import com.cqq.print.business.dao.query.StatisticsPublisherQuery;
import com.cqq.print.business.service.StatisticsPublisherService;
import com.cqq.print.business.service.bean.StatisticsPublisherBean;
import com.cqq.print.business.service.bean.StatisticsPublisherQueryBean;

/**
 *	@author CHENQQ
 *	@Date 2016年5月10日
 */

@Service("statisticsPublisherService")
public class StatisticsPublisherServiceImpl implements StatisticsPublisherService{
	
	@Autowired
	private StatisticsPublisherDao statisticsPublisherDao;

	public PageInfoBean<StatisticsPublisherBean> queryStatisticsPublisher(
			StatisticsPublisherQueryBean queryBean) {
		if(queryBean==null)
			return null;
		StatisticsPublisherQuery query = new StatisticsPublisherQuery();
		BeanUtils.copyProperties(queryBean, query);
		int count = statisticsPublisherDao.queryStatisticsPublisherCount(query);
		List<StatisticsPublisherBean> listBean = null;
		if(count>=0){
			List<StatisticsPublisher> list = statisticsPublisherDao.queryStatisticsPublisher(query);
			listBean = BeanUtil.copyList(list, StatisticsPublisherBean.class);
		}
		
		return new PageInfoBean<StatisticsPublisherBean>(listBean, count, queryBean.getPageSize(), queryBean.getPageNo());
	}

}
